The ENVI Extension Wizard allows you to create an IDL project to be used as a custom ENVI extension. Custom ENVI extensions appear in the Toolbox within the ENVI application.
The steps necessary to build an ENVI extension are:
Note: If you have already run ENVI in the same session, you should execute a .RESET_SESSION command before restarting ENVI, to ensure that your new extension is loaded.
To display the ENVI Extension Wizard, either select File->New ENVI Extension, or right-click in the Project Explorer and select New ENVI Extension from the context menu. The following fields are displayed in the wizard:
The name of the IDL project that will contain the new extension. This project name must be unique. See Projects for details.
The human-readable name of the extension. This is the name that will be displayed in the Extensions Toolbox within the ENVI application.
The name of the IDL procedure to run when the extension is executed. This needs to be a valid IDL procedure name. This will also be used as the name of the .pro file that gets created.
A string denoting the tree structure, under the Extensions folder, in which the Toolbox item will appear. If the Extension Path is empty, the item will be added directly to the end of the Extensions folder. Multiple subfolders may be specified by adding the '/' character between folder names (for example, "My Routines/Statistics"). If a folder does not currently exist, it will be created.
The location where the IDL SAVE file should be created when the project is built (see Building IDL Projects). The ENVI application looks in three locations for extensions:
If left empty, this field is set to the user's home directory. After the IDL project has been created, you can go to the IDL Build Properties page to modify the SAVE file location.
After you run the ENVI Extension Wizard, a new IDL editor opens, containing the extension code. The extension name, IDL procedure name, and extension path are automatically added to the code.
By default, the extension file contains an "_extensions_init" procedure at the top, followed by the actual extension procedure. The extension procedure has a section of generic error-handling code, and then a line of code to retrieve the current ENVI application object. Finally, you should insert your custom extension code near the bottom of the file, after the IDL comment block marked "Insert your ENVI Extension code here...".
If you wish, you may modify the default extension template code that is inserted. To modify the template, open the Preferences dialog in the IDL Workbench. In the Preferences dialog, choose IDL >Templates, and edit the ENVIExtension template to contain your desired code. The following custom variables are available:
Variable |
Description |
---|---|
${EXTENSION_NAME} |
The ENVI Extension name from the Wizard |
${PROCEDURE_NAME} |
The IDL Procedure name from the Wizard |
${EXTENSION_PATH} |
The Extension Path value from the Wizard |
In addition, you can also use any of the other IDL template variables, such as ${date}, ${time}, ${user}, or ${year}.